package com.authine.cloudpivot.ext.dto.kingDee.request;

import com.authine.cloudpivot.ext.constants.PlatformConst;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * 金蝶 转采退货模型 入参
 */
@Api("K3-转采退货")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Schema(description = "转采退货模型")
public class KingDeeMemberPurchaseOrder implements Serializable {

    private static final long serialVersionUID = 8027771251451545279L;
    /**
     * 转采po号
     */
    @Schema(description = "转采po号")
    private String poCode;
    /**
     * 转采供应商ID
     */
    @Schema(description = "转采供应商ID")
    private String vendorId;
    /**
     * 采购总价 未税
     */
    @Schema(description = "采购总价 未税")
    private BigDecimal prePurchaseAmount;
    /**
     * 转采供应商名称
     */
    @Schema(description = "转采供应商名称")
    private String transferVendorName;
    /**
     * 是否是退货单
     */
    @Schema(description = "是否是退货单")
    private Boolean isRp;
    /**
     * 商品
     */
    @Schema(description = "商品")
    private List<KingDeeMemberPurchaseOrderGood> kingDeeMemberPurchaseOrderGoods;
    /**
     * 账套名
     */
    @Schema(description = "账套名")
    private String accountName;

    public String getAccountName() {
        return StringUtils.isBlank(accountName)?accountName: PlatformConst.PLATFORM_ORGANIZATIONS.get("2").equals(accountName)?"2":"1";
    }
}
